//package com.smartstate.iot.service;
//
//import com.alibaba.fastjson.JSONObject;
//import com.smartstate.iot.config.web.SpringUtils;
//import com.smartstate.iot.mqtt.client.MyMQTTClient;
//import com.smartstate.iot.mqtt.common.GlobalMqttParam;
//import org.eclipse.paho.client.mqttv3.MqttException;
//import org.springframework.stereotype.Component;
//
//@Component
//public class ConfigTransmitService {
//
//    GlobalMqttParam globalMqttParam = SpringUtils.getBean(GlobalMqttParam.class);
//    String broker = globalMqttParam.getBroker();
//    String userName = globalMqttParam.getUserName();
//    String passWord = globalMqttParam.getPassWord();
//    String clientId1 = globalMqttParam.getSubClientId1();
//    String subTopic1 = globalMqttParam.getSubTopic1();
//    int keepalive = globalMqttParam.getKeepalive();
//    int timeout = globalMqttParam.getTimeout();
//    MyMQTTClient myMQTTClient = new MyMQTTClient(broker, userName, passWord, clientId1, keepalive, timeout);
//
//    public void transmit(JSONObject msg) {
//        try {
//            myMQTTClient.connect();
//            myMQTTClient.publish(msg.toJSONString(),"SH/HK/NJ/CONFIG",2,false);
//        } catch (MqttException e) {
//            throw new RuntimeException(e);
//        }
//    }
//}
